window.addEventListener('load', function() {

    var book = document.querySelectorAll('.book');
    //querySelectorAll和getElement...返回元素数组集合
    //querySelector返回第一个元素
    var mask = document.querySelector('.Mask');
    for (var i = 0; i < book.length; i++) {
        book[i].onclick = function() {
            mask.style.display = 'block';

        }
    }
    document.querySelector('.close').onclick = function() {
        mask.style.display = 'none';
    }
    var search = document.querySelector('.search');
    var text = search.children[0];
    search.children[1].onclick = function() {
        if (text.textContent == '') {
            alert('您还没有输入任何内容！');
        } else {
            alert('YES');
        }
    };
    text.onfocus = function() {
        console.log('获得了焦点');
        if (text.value == '请搜索') {
            text.value = '';
        }
    }
    text.onblur = function() {
        console.log('失去了焦点');
        if (text.value == '') {
            text.value = '请搜索';
        }
    }





})